﻿(function () {
    oo('class', {
        $ajax: function () {
            $.ajaxSetup({
                type: 'POST',
                async: true,
                cache: false,
                dataType: 'json',
                error: function (a, b, c) {
                    console.log('error');
                }
            });
        },
        _ajax: function (options) {
            var callback = options.success;
            options.success = function (result) {
                if (typeof result == 'object' && result.hasOwnProperty('redirect'))
                    location.href = result.redirect;
                else
                    callback(result);
            };
            $.ajax(options);
        }
    });
})(jQuery);